/***
 * 依赖管理
 */
require.config({
    baseUrl : "_static_",
    paths : {
        "axios" : ["https://cdn.staticfile.org/axios/0.21.1/axios.min"], 
        "Vue" : ["https://cdn.staticfile.org/vue/2.6.12/vue.min"], 
        "VueRouter" : ["https://cdn.staticfile.org/vue-router/3.4.9/vue-router.min"], 
        "jquery" : ["https://cdn.staticfile.org/jquery/1.12.4/jquery.min"], 
        "echarts" : ["https://cdn.staticfile.org/echarts/5.0.0/echarts.min"]
    }
});


/**
 * 主入口
 */
require( [
    'Vue', 'VueRouter', // 
    'IndexComponent', 'ForceGraphComponent', 'GraphDataComponent', 'SystemInfoComponent', 'SystemPropertyComponent', // 
    'ProviderListComponent', 'ProviderComponent', 'ShardingComponent', 'Component404', 'TableComponent', //
    'TableSqlComponent', 'MethodComponent', 'MethodRefComponent', 'MetricComponent', 'MetricRefComponent'
], function ( 
    Vue, VueRouter, // 
    IndexComponent, ForceGraphComponent, GraphDataComponent, SystemInfoComponent, SystemPropertyComponent, // 
    ProviderListComponent, ProviderComponent, ShardingComponent, Component404, TableComponent, //
    TableSqlComponent, MethodComponent, MethodRefComponent, MetricComponent, MetricRefComponent
) {

    Vue.use(VueRouter); // 必须的

    var routes = [
        { path: '/', component: IndexComponent },
        { path: '/force-graph', component: ForceGraphComponent },
        { path: '/graph-data', component: GraphDataComponent },
        { path: '/system-info', component: SystemInfoComponent },
        { path: '/system-property', component: SystemPropertyComponent },
        { path: '/sharding', component: ShardingComponent },
        { path: '/table', component: TableComponent },
        { path: '/method', component: MethodComponent },
        { path: '/metric', component: MetricComponent },
        { path: '*', component: Component404 }
    ];

    var router = new VueRouter({ routes });

    var app = new Vue({ 
        router 
    }).$mount('#app');
});
